1. Technical Field
The present invention concerns a method and system for enabling a server application to be executed in the same Virtual Machine (VM) as a client application using direct object oriented programming method calls, without the need for remote communications protocol processing of the method calls. The present invention is particularly directed to a computing device hosting a single Java VM (JVM) for enabling a client application to make method calls to a server application also executing on the JVM through a direct Java interface of the client program.
2. Background Art
Object oriented programming based on an object model is a new way of programming computer programs that has become very popular over the past several years. Object oriented programming uses objects as its fundamental program building blocks rather than procedures as in conventional procedural programming. The focus of object-oriented program design is to define a set of autonomous entities that can work together. These autonomous entities are, of course, the objects.
Conceptually, an object has two parts, an external object interface and internal object data. Internal data is encapsulated by the object interface such that other objects must communicate with that object through its interface. Thus, the only way to retrieve, process or otherwise operate on the encapsulated data is through methods defined for the object. This protects the internal portion of the object from outside tampering. Additionally, because outside objects have no access to the internal implementation, that internal implementation can change without affecting other aspects of the program. The object system thus isolates the requester of services (clients) from the providers of services (servers) by a well defined encapsulating interface.
Data in an object is operated upon by calling “methods” of the object. In the object model, a client object sends a call to the server object system. The call identifies a particular object and specifies what method is to be performed by the object, and provides any parameters required. The object interprets the message to decide what service to perform, and returns back any data that results.
Because all operations on an object are expressed as calls from one object to another, methods can be called by remote objects. Objects that reside in different locations that communicate with each other across a network are called distributed objects in a distributed object system.
Another central concept in object-oriented programming is the class. A class is a template that defines a type of object. A class is defined by a set of class parameters that specify the details of objects that belong to its class. By defining a class, objects can be created that belong to the class without having to rewrite the entire definition. This promotes the reusability of existing definitions and promotes efficient use of program code.
There are many computer languages that support object-oriented programming. For example, Smalltalk, Object Pascal, C++ and Java are all programming languages that to one degree or another support object-oriented programming. Any of these and others can be used to write programs that use objects.
Several standards exist to provide for the sharing of objects across various types of networks, operating systems and hardware platforms. These standards lower the cost of developing distributed object computing systems. One such standard is the Common Object Request Broker Architecture (CORBA) specification as established by the Object Management Group (OMG). CORBA is an OMG specification designed to provide for the sharing of objects across a wide variety of hardware platforms and operating systems. Applications that conform to the CORBA specification can communicate with one another regardless of location or vendor. In particular, CORBA defines interoperability by specifying the design of Object Request Brokers (ORBs) such that ORBs from different vendors can interoperate. This is done by defining ORB interfaces in a language-independent specification.
An ORB is a program that establishes client-server relationships between objects. ORBs provide the infrastructure that allows objects to converse, independent of the specific platforms and techniques used to implement the objects. Using an ORB, a client can transparently invoke a method on a server object, which can be on the same machine or across a network. The ORB operates by intercepting method calls and finding an object that can implement the request, passing the request parameters to the object, invoking the method, and returning the results. While doing so, the client does not have to be aware of where the object is located, its programming language, its operating system and any other system aspects. Thus, the ORB provides interoperability between applications on different machines in heterogeneous distributed object environments and seamlessly inter-connects multiple object systems.
CORBA uses the concept of a proxy object to facilitate communication between distributed objects. A proxy object is an object of a proxy class that has the same methods as a particular real object, except that each method on the proxy object does nothing other than forward the method request through an ORB and across the network to the real object. A proxy object thus has the same interface as the real object (i.e., the methods that can be performed on the object) but has a different implementation (i.e., instead of performing the method, the method request is passed to the real object).
Java is a modem object oriented programming language specially designed to create distributed object systems. Java is a trademark of Sun Microsystems Inc. Java offers many features and advantages that make it possibly the most desirable object oriented programming language to use. First, Java is specifically designed to create small programs, commonly called applets, that can reside on the network in centralized servers, and are delivered to the client machine only when needed. Second, Java is completely platform independent. A Java program can be written once and run on any type of platform that contains a Java Virtual Machine (JVM). Third, Java is an object oriented language, meaning that software written in Java can take advantage of the benefits of object oriented programming.
As in other object oriented systems, operations are performed by an object calling a method of another object. These objects can reside locally on the same machine or on separate JVM's on separate computers (Java objects on separate JVM's are called remote objects). This remote object interaction can be done using ORB's, as discussed above, or it can be done using the Java Remote Method Invocation (RMI) standard.
The Java RMI standard provides a system that has been specifically designed to facilitate distributed object interaction for Java Objects. The Java RMI, as it is designed for only Java objects, can provide seamless integration between Java Objects by taking advantage of the Java object model whenever possible. The Java RMI is designed to support seamless remote invocation of objects on different machines, and thus make the creation of reliable distributed applications as simple as possible.
As stated before, object-oriented programming uses objects that interact with each other through method calls. These method calls are implemented by threads. For example, for an object A to interact with an object B, a thread first gets object A. While running within A's method, the thread then gets object B and calls one of B's methods. Thus, all parts of the interaction are performed by the same thread. This interaction is referred to as “A calls B”.
In distributed object systems, such as Java RMI, the interaction between threads and objects is more complex. In these distributed systems, a “client object” runs in a client thread on the client system and calls methods on a “server object”, which runs in a server thread on a server system. In particular, making a call from an object A to an object B (where B is on a remote machine) involves a client thread “getting” object A, and then “invoking” A's method to call object B (where “getting” an object comprises obtaining a pointer to the object and “invoking” comprises allocating a stack frame to run the object's method). To call object B in a CORBA or Java RMI system, the client thread must first get a proxy object for object B. After getting the proxy, the client thread then invokes the same method on the proxy as if it was calling the method on the real object B. The code of the proxy's method, running in the client thread, delivers the call and all parameters to the real object B through the infrastructure (e.g., transport layer) of the distributed object system. The client thread then waits for the return (with or without a return value) of the remote call.
On the server side, the distributed system typically has a connection for remote call requests. When this server thread receives the call, it extracts all the data passed from the client side. From this data, the server thread gets the requested real object, and invokes the requested method on it. When the method is done, the server thread passes any return value back to the client side. These are done within the server thread. Thus, all the activity on the server side is done within the server thread.
Where the distributed object system is a Java based system, a method call from a client object to a remote server object is executed in its own dedicated JVM hosted by the application server with the method call on the client machine side being executed by its own dedicated JVM hosted by the client machine. Communication of such method calls from client machines to remote application servers are implemented by suitable remote communications protocols or mechanisms such as MBeans, SOAP requests or Web interfaces.
Message driven beans (MBeans or “Message Beans”) are one of the family of component bean types defined by the Enterprise Java Bean (EJB) specification. The bean types include session beans, which contain business logic and maintain a state associated with client sessions, and entity beans, which map objects to persistent data. Message driven beans provide asynchrony to EJB based applications by acting as message consumers. A message bean receives messages sent by clients or other beans. Messages sent to the Message bean are placed in a queue and processed by the EJB server asynchronously.
The Simple Object Access Protocol (SOAP) is an XML-based lightweight protocol for the exchange of information in a decentralized, distributed environment. SOAP defines a messaging protocol between requestor and provider objects, such that the requesting objects can perform a remote method invocation on the providing objects in an object-oriented programming fashion. The SOAP specification was co-authored by Microsoft, IBM, Lotus, UserLand, and DevelopMentor.
The Extensible Mark-up Language (XML) is a text-based mark-up language specification from the World Wide Web Consortium (W3C). Unlike HyperText Markup Language (HTML), which uses tags for describing presentation and data, XML is strictly for the definition of portable structured data. It can be used as a language for defining data descriptive languages, such as mark-up grammars or vocabularies and interchange formats and messaging protocols. XML messages may be written using WSDL.
The Web Services Description Language (WSDL) is an XML vocabulary that provides a standard way of describing service Interface Definition Languages (IDLs). WSDL is the resulting artefact of a convergence of activity between the Network Accessible Service Specification Language (NASSL) developed by IBM and the Specification and Description Language (SDL) developed by Microsoft. It provides a simple way for service providers to describe the format of requests and response messages for remote method invocations (RMIs). WSDL addresses this topic of service IDLs independently of the underlying protocol and encoding requirements. In general, WSDL provides an abstract language for defining the published operations of a service with their respective parameters and data types. The language also addresses the definition of the location and binding details of the service.
A problem encountered with communicating method calls (object requests) using such mechanism or protocols is that they invariably involve performance issues due to the distance between client and server and the overhead associated with serializing and de-serializing the requests at each end.
When the server application is embedded in a local client application, i.e., being executed by the same computing machine, the communications mechanisms and protocols described above are still employed to communicate a request from the client object to the server object (these now being hosted by one and the same machine but executed by separate JVMs hosted by the machine) as though the system were still a distributed object system. Consequently, the described communications mechanisms and protocols constitute an unnecessary overhead and the interfaces between the client and server are redundant.
It is an object of the invention to mitigate and/or obviate problems associated with the interoperation of client and server applications on the same machine.
It is a further object of the invention to provide an interface enabling a server application to be executed in the same VM as a client application using standard object oriented programming method calls without the need for remote communications protocol processing of the method calls.